const express = require('express')
const router = express.Router()
const userCtrl = require('../controller/user')
// 1. 导入验证数据的中间件
const expressJoi = require('@escook/express-joi')
// 2. 导入需要的验证规则对象
const { reg_login_util,userAdd_util } = require('../util/user')

//登录
router.post('/login',expressJoi(reg_login_util),userCtrl.login)
//注册
router.post('/register',expressJoi(reg_login_util),userCtrl.register)
//添加账号
router.post('/userAdd',expressJoi(userAdd_util),userCtrl.userAdd)
//当前角色
router.get('/role',userCtrl.role)

module.exports = router